package com.happybluefin.tapburstfree.common.tencentweibo;

import com.tencent.weibo.oauthv2.OAuthV2;
import com.tencent.weibo.webview.OAuthV2AuthorizeWebView;

import android.app.Activity;
import android.content.Intent;
import android.util.Log;

public class TencentWeibo {
    public TencentWeibo(Activity parent) {
        Log.d(TAG, "TencentWeibo() start");

        mParent = parent;

        Log.d(TAG, "TencentWeibo() end");
    }

    public void share(final String text) {
        Log.d(TAG, "share() start");

        OAuthV2 oAuth = new OAuthV2(APP_REDIRECT_URL);
        oAuth.setClientId(APP_KEY);
        oAuth.setClientSecret(APP_SECRET);

        Intent intent = new Intent(mParent, OAuthV2AuthorizeWebView.class);   
        intent.putExtra("oauth", oAuth);
        mParent.startActivityForResult(intent, TENCENT_WEIBO_REQUEST_CODE);

        Log.d(TAG, "share() end");
    }

    protected Activity mParent = null;

    protected static final String APP_KEY = "801237739";

    protected static final String APP_SECRET = "85507f7d11b18aa4b3797749698d4599";

    protected static final String APP_REDIRECT_URL = "http://www.happybluefin.com";

    protected static final String TAG = "TencentWeibo";
    
    public static final int TENCENT_WEIBO_REQUEST_CODE = 1;
}
